<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <title>LCOV - ged.info - gil/position_iterator.hpp</title>
  <link rel="stylesheet" type="text/css" href="../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LTP GCOV extension - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
        <tr>
          <td class="headerItem" width="20%">Current&nbsp;view:</td>
          <td class="headerValue" width="80%" colspan=4><a href="../index.html">directory</a> - <a href="index.html">gil</a> - position_iterator.hpp</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Test:</td>
          <td class="headerValue" width="80%" colspan=4>ged.info</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Date:</td>
          <td class="headerValue" width="20%">2009-06-09</td>
          <td width="20%"></td>
          <td class="headerItem" width="20%">Instrumented&nbsp;lines:</td>
          <td class="headerValue" width="20%">4</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Code&nbsp;covered:</td>
          <td class="headerValue" width="20%">100.0 %</td>
          <td width="20%"></td>
          <td class="headerItem" width="20%">Executed&nbsp;lines:</td>
          <td class="headerValue" width="20%">4</td>
        </tr>
        </table>
      </td>
    </tr>
    <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td><pre class="source">
<span class="lineNum">       1 </span>                : /*
<span class="lineNum">       2 </span>                :     Copyright 2005-2007 Adobe Systems Incorporated
<span class="lineNum">       3 </span>                :    
<span class="lineNum">       4 </span>                :     Use, modification and distribution are subject to the Boost Software License,
<span class="lineNum">       5 </span>                :     Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
<span class="lineNum">       6 </span>                :     http://www.boost.org/LICENSE_1_0.txt).
<span class="lineNum">       7 </span>                : 
<span class="lineNum">       8 </span>                :     See http://opensource.adobe.com/gil for most recent version including documentation.
<span class="lineNum">       9 </span>                : */
<span class="lineNum">      10 </span>                : 
<span class="lineNum">      11 </span>                : /*************************************************************************************************/
<span class="lineNum">      12 </span>                : 
<span class="lineNum">      13 </span>                : #ifndef GIL_POSITION_ITERATOR_HPP
<span class="lineNum">      14 </span>                : #define GIL_POSITION_ITERATOR_HPP
<span class="lineNum">      15 </span>                : 
<span class="lineNum">      16 </span>                : ////////////////////////////////////////////////////////////////////////////////////////
<span class="lineNum">      17 </span>                : /// \file               
<span class="lineNum">      18 </span>                : /// \brief Locator for virtual image views
<span class="lineNum">      19 </span>                : /// \author Lubomir Bourdev and Hailin Jin \n
<span class="lineNum">      20 </span>                : ///         Adobe Systems Incorporated
<span class="lineNum">      21 </span>                : /// \date   2005-2007 \n Last updated on February 12, 2007
<span class="lineNum">      22 </span>                : ///
<span class="lineNum">      23 </span>                : ////////////////////////////////////////////////////////////////////////////////////////
<span class="lineNum">      24 </span>                : 
<span class="lineNum">      25 </span>                : #include &lt;boost/iterator/iterator_facade.hpp&gt;
<span class="lineNum">      26 </span>                : #include &quot;locator.hpp&quot;
<span class="lineNum">      27 </span>                : 
<span class="lineNum">      28 </span>                : namespace boost { namespace gil {
<span class="lineNum">      29 </span>                : 
<span class="lineNum">      30 </span>                : /// \defgroup PixelIteratorModelVirtual position_iterator
<span class="lineNum">      31 </span>                : /// \ingroup PixelIteratorModel
<span class="lineNum">      32 </span>                : /// \brief An iterator that remembers its current X,Y position and invokes a function object with it upon dereferencing. Models PixelIteratorConcept, PixelBasedConcept, HasDynamicXStepTypeConcept. Used to create virtual image views. 
<span class="lineNum">      33 </span>                : 
<span class="lineNum">      34 </span>                : 
<span class="lineNum">      35 </span>                : /// \brief An iterator that remembers its current X,Y position and invokes a function object with it upon dereferencing. Models PixelIteratorConcept. Used to create virtual image views.
<span class="lineNum">      36 </span>                : ///    Models: StepIteratorConcept, PixelIteratorConcept, PixelBasedConcept, HasDynamicXStepTypeConcept
<span class="lineNum">      37 </span>                : /// \ingroup PixelIteratorModelVirtual PixelBasedModel
<span class="lineNum">      38 </span>                : template &lt;typename Deref, // A function object that given a point returns a pixel reference. Models PixelDereferenceAdaptorConcept
<span class="lineNum">      39 </span>                :           int Dim&gt;        // the dimension to advance along
<span class="lineNum">      40 </span>                : struct position_iterator : public iterator_facade&lt;position_iterator&lt;Deref,Dim&gt;,
<span class="lineNum">      41 </span>                :                                                   typename Deref::value_type,
<span class="lineNum">      42 </span>                :                                                   random_access_traversal_tag,
<span class="lineNum">      43 </span>                :                                                   typename Deref::reference,
<span class="lineNum">      44 </span><span class="lineCov">              3 :                                                   typename Deref::argument_type::template axis&lt;Dim&gt;::coord_t&gt; {</span>
<span class="lineNum">      45 </span>                :     typedef iterator_facade&lt;position_iterator&lt;Deref,Dim&gt;,
<span class="lineNum">      46 </span>                :                             typename Deref::value_type,
<span class="lineNum">      47 </span>                :                             random_access_traversal_tag,
<span class="lineNum">      48 </span>                :                             typename Deref::reference,
<span class="lineNum">      49 </span>                :                             typename Deref::argument_type::template axis&lt;Dim&gt;::coord_t&gt; parent_t;
<span class="lineNum">      50 </span>                :     typedef typename parent_t::difference_type difference_type;
<span class="lineNum">      51 </span>                :     typedef typename parent_t::reference       reference;
<span class="lineNum">      52 </span>                :     typedef typename Deref::argument_type      point_t;
<span class="lineNum">      53 </span>                : 
<span class="lineNum">      54 </span>                :     position_iterator() {}
<span class="lineNum">      55 </span><span class="lineCov">              4 :     position_iterator(const point_t&amp; p, const point_t&amp; step, const Deref&amp; d) : _p(p), _step(step), _d(d) {}</span>
<span class="lineNum">      56 </span>                : 
<span class="lineNum">      57 </span><span class="lineCov">              4 :     position_iterator(const position_iterator&amp; p) : _p(p._p), _step(p._step), _d(p._d) {}</span>
<span class="lineNum">      58 </span>                :     template &lt;typename D&gt; position_iterator(const position_iterator&lt;D,Dim&gt;&amp; p) : _p(p._p), _step(p._step), _d(p._d) {}
<span class="lineNum">      59 </span><span class="lineCov">              2 :     position_iterator&amp; operator=(const position_iterator&amp; p) { _p=p._p; _d=p._d; _step=p._step; return *this; }</span>
<span class="lineNum">      60 </span>                : 
<span class="lineNum">      61 </span>                :     const point_t&amp;   pos()      const { return _p; }
<span class="lineNum">      62 </span>                :     const point_t&amp;   step()     const { return _step; }
<span class="lineNum">      63 </span>                :     const Deref&amp;     deref_fn() const { return _d; }
<span class="lineNum">      64 </span>                : 
<span class="lineNum">      65 </span>                :     void set_step(difference_type s) { _step[Dim]=s; }
<span class="lineNum">      66 </span>                :     /// For some reason operator[] provided by iterator_adaptor returns a custom class that is convertible to reference
<span class="lineNum">      67 </span>                :     /// We require our own reference because it is registered in iterator_traits
<span class="lineNum">      68 </span>                :     reference operator[](difference_type d) const { point_t p=_p; p[Dim]+=d*_step[Dim]; return _d(p); }
<span class="lineNum">      69 </span>                : 
<span class="lineNum">      70 </span>                : private:
<span class="lineNum">      71 </span>                :     point_t _p, _step;
<span class="lineNum">      72 </span>                :     Deref   _d;
<span class="lineNum">      73 </span>                : 
<span class="lineNum">      74 </span>                :     template &lt;typename DE, int DI&gt; friend struct position_iterator;
<span class="lineNum">      75 </span>                :     friend class boost::iterator_core_access;
<span class="lineNum">      76 </span>                :     reference dereference()     const { return _d(_p); }
<span class="lineNum">      77 </span>                :     void increment()                  { _p[Dim]+=_step[Dim]; }
<span class="lineNum">      78 </span>                :     void decrement()                  { _p[Dim]-=_step[Dim]; }
<span class="lineNum">      79 </span>                :     void advance(difference_type d)   { _p[Dim]+=d*_step[Dim]; }
<span class="lineNum">      80 </span>                : 
<span class="lineNum">      81 </span>                :     difference_type distance_to(const position_iterator&amp; it) const { return (it._p[Dim]-_p[Dim])/_step[Dim]; }
<span class="lineNum">      82 </span>                :     bool equal(const position_iterator&amp; it) const { return _p==it._p; }
<span class="lineNum">      83 </span>                : };
<span class="lineNum">      84 </span>                : 
<span class="lineNum">      85 </span>                : template &lt;typename Deref,int Dim&gt; 
<span class="lineNum">      86 </span>                : struct const_iterator_type&lt;position_iterator&lt;Deref,Dim&gt; &gt; {
<span class="lineNum">      87 </span>                :     typedef position_iterator&lt;typename Deref::const_t,Dim&gt; type;
<span class="lineNum">      88 </span>                : };
<span class="lineNum">      89 </span>                : 
<span class="lineNum">      90 </span>                : template &lt;typename Deref,int Dim&gt; 
<span class="lineNum">      91 </span>                : struct iterator_is_mutable&lt;position_iterator&lt;Deref,Dim&gt; &gt; : public mpl::bool_&lt;Deref::is_mutable&gt; {
<span class="lineNum">      92 </span>                : };
<span class="lineNum">      93 </span>                : 
<span class="lineNum">      94 </span>                : /////////////////////////////
<span class="lineNum">      95 </span>                : //  PixelBasedConcept
<span class="lineNum">      96 </span>                : /////////////////////////////
<span class="lineNum">      97 </span>                : 
<span class="lineNum">      98 </span>                : template &lt;typename Deref,int Dim&gt; 
<span class="lineNum">      99 </span>                : struct color_space_type&lt;position_iterator&lt;Deref,Dim&gt; &gt; : public color_space_type&lt;typename Deref::value_type&gt; {};
<span class="lineNum">     100 </span>                : 
<span class="lineNum">     101 </span>                : template &lt;typename Deref,int Dim&gt; 
<span class="lineNum">     102 </span>                : struct channel_mapping_type&lt;position_iterator&lt;Deref,Dim&gt; &gt; : public channel_mapping_type&lt;typename Deref::value_type&gt; {};
<span class="lineNum">     103 </span>                : 
<span class="lineNum">     104 </span>                : template &lt;typename Deref,int Dim&gt; 
<span class="lineNum">     105 </span>                : struct is_planar&lt;position_iterator&lt;Deref,Dim&gt; &gt; : public mpl::false_ {};
<span class="lineNum">     106 </span>                : 
<span class="lineNum">     107 </span>                : template &lt;typename Deref,int Dim&gt; 
<span class="lineNum">     108 </span>                : struct channel_type&lt;position_iterator&lt;Deref,Dim&gt; &gt; : public channel_type&lt;typename Deref::value_type&gt; {};
<span class="lineNum">     109 </span>                : 
<span class="lineNum">     110 </span>                : /////////////////////////////
<span class="lineNum">     111 </span>                : //  HasDynamicXStepTypeConcept
<span class="lineNum">     112 </span>                : /////////////////////////////
<span class="lineNum">     113 </span>                : 
<span class="lineNum">     114 </span>                : template &lt;typename Deref,int Dim&gt; 
<span class="lineNum">     115 </span>                : struct dynamic_x_step_type&lt;position_iterator&lt;Deref,Dim&gt; &gt; {
<span class="lineNum">     116 </span>                :     typedef position_iterator&lt;Deref,Dim&gt; type;
<span class="lineNum">     117 </span>                : };
<span class="lineNum">     118 </span>                : 
<span class="lineNum">     119 </span>                : } }  // namespace boost::gil
<span class="lineNum">     120 </span>                : 
<span class="lineNum">     121 </span>                : #endif
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
  <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
  <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LTP GCOV extension version 1.6</a></td></tr>
  </table>
  <br>

</body>
</html>
